package com.eee.machine.controller;

import com.eee.machine.common.TableData;
import com.eee.machine.service.ISalesManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/salesMan")
public class SalesManController {

    @Autowired
    private ISalesManService salesManService;

    @RequestMapping("/getAllSalesMan")
    @ResponseBody
    TableData getAllSalesMan(@RequestParam(value = "page") String page, @RequestParam(value = "limit") String limit,
                             @RequestParam(value = "phone",required = false) String phone){
        return salesManService.getAllSalesMan(Long.parseLong(page), Long.parseLong(limit), phone);
    }

    @RequestMapping("/findSaleMan")
    @ResponseBody
    TableData findSaleMan(@RequestParam(value = "phone")  String phone){
        return salesManService.findSaleMan(phone);
    }
}
